package com.demo.test.command;

import com.demo.test.command.iml.Command;

import java.util.ArrayList;
import java.util.List;

public class Invoker {

    private List<Command> commands = new ArrayList<>();

    public Invoker(Command command){
        this.commands.add(command);
    }

    public void setCommand(Command command) {
        this.commands.add(command);
    }

    public void call(){

        for(Command command:commands){
            command.execute();
        }

    }
}
